{% extends "./layout/layout.html" %}
{% block title %}
<title>资料下载</title>
{% endblock %}

{% block content %}
<div class="sevrdw1">
  <div class="box wow fadeInUp">
    <div class="tt f_30">资料下载</div>
    <div class="en f_16">DOWNLOAD</div>
    <div class="nday clearfix  alltime wow fadeInUp">
      <div class="nlt clearfix">
        <div class="sx clearfix">
          <span class="" data-days="30">近30天</span>
          <span class="" data-days="90">近90天</span>
          <span class="" data-days="365">近1年</span>
          <span class="act" data-days="0">全部</span>
        </div>
      </div>
      <div class="nrt clearfix">
        <input type="text" id="pageKeywords" placeholder="请输入关键字...">
        <a onclick="location='search_do.html?key='+document.getElementById('pageKeywords').value"></a>
      </div>
    </div>
    <ul class="ul1 alltime dataul">

    </ul>
    <div class="page">

      <a id="more" class="page2">加载更多</a>
    </div>
  </div>
</div>
{% endblock %}

{% block script %}
<script>
  $('.head .abtn .yjdh a').eq(3).addClass('act');
  $(function () {
    var curpage = 1;
    var pagecount = 0;

    $("#more").click(function () {
      curpage++;
      loadingList();
    })

    function loadingList() {

      $.ajax({
        url: '/Ajax/Handler.ashx',
        type: 'post',
        dataType: "json",
        data: {
          'type': 'GetNewsList',
          'classId': '41',
          'pagesize': '5',
          'page': curpage
        },
        success: function (data) {
          dataList = data;
          var html = "";
          for (var i = 0; i < dataList.length; i++) {
            if (i >= dataList.length) {
              break;
            }
            html += '<li>';
            html += '<a href="' + dataList[i].FileUrl + '" class="clearfix" download>';
            var str = '';
            str = dataList[i].FileUrl.substr(dataList[i].FileUrl.lastIndexOf(".") + 1, dataList[i].FileUrl
              .length).toUpperCase();
            html += '<div class="img">' + str + '</div>';
            html += '<div class="lcon">';
            html += '<div class="ltt">文件名：' + dataList[i].Title + '</div>';
            html += '<div class="ltc f_12">您可以直接下载此文件！</div>';
            html += '</div>';
            html += '<div class="tp"></div>';
            html += '</a>';
            html += '</li>';
          }
          $(".dataul").append(html);
          if (curpage >= pagecount) {
            $("#more").remove();
          }
        },
        error: function (err) {
          console.log(err)
        }
      });

    }

    function getFDate(date) {
      var d = eval('new ' + date.substr(1, date.length - 2));

      var ar_date = [d.getFullYear(), d.getMonth() + 1, d.getDate()];

      for (var i = 0; i < ar_date.length; i++) ar_date[i] = dFormat(ar_date[i]);
      return ar_date.join('-');
    }

    function dFormat(i) {
      return i < 10 ? "0" + i.toString() : i;
    }

    function Replacestring(string) {
      if (string) {
        return string.replace(/\r\n/g, "</br>");
      } else {
        return "";
      }
    }
  })
  $("#pageKeywords").bind('keypress', function (event) {
    if (event.keyCode == 13) {
      location = "search_do.html?key=" + $(this).val();
      return false;
    }
  });
</script>
{% endblock %}